﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Booking_Hotel.DBML;

namespace Booking_Hotel.DAL
{
    public class Supplier_hotel_loaiphong_khuyenmaiDAO
    {
        ThanhBHotelDataContext sdb = new ThanhBHotelDataContext();
        
        public void addSupplier_Hotel_loaiphong_khuyenmai(Supplier_Hotel_LoaiPhong_KhuyenMai shlk)
        {
            Supplier_Hotel_LoaiPhong_KhuyenMai add = new  Supplier_Hotel_LoaiPhong_KhuyenMai
            {
                Supplier_Hotel_LoaiPhongID = shlk.Supplier_Hotel_LoaiPhongID, 
	            TenKhuyenMai = shlk.TenKhuyenMai,
	            Description = shlk.Description,
	            GiaKhuyenMai = shlk.GiaKhuyenMai,
	            ThoiGianBatDau= shlk.ThoiGianBatDau,
	            ThoiGianKetThuc = shlk.ThoiGianKetThuc
                
            };
            sdb.Supplier_Hotel_LoaiPhong_KhuyenMais.InsertOnSubmit(add);
            sdb.SubmitChanges();
        }
        public void updateSupplier_Hotel_loaiphong_khuyenmai(Supplier_Hotel_LoaiPhong_KhuyenMai shlk)
        {
            Supplier_Hotel_LoaiPhong_KhuyenMai update = sdb.Supplier_Hotel_LoaiPhong_KhuyenMais.Single(ca => ca.Supplier_Hotel_LoaiPhong_KhuyenMaiID == (int)shlk.Supplier_Hotel_LoaiPhong_KhuyenMaiID);
            {
                update.Supplier_Hotel_LoaiPhong_KhuyenMaiID = shlk.Supplier_Hotel_LoaiPhong_KhuyenMaiID;
                update.Supplier_Hotel_LoaiPhongID = shlk.Supplier_Hotel_LoaiPhongID;
                update.TenKhuyenMai = shlk.TenKhuyenMai;
                update.Description = shlk.Description;
                update.GiaKhuyenMai = shlk.GiaKhuyenMai;
                update.ThoiGianBatDau = shlk.ThoiGianBatDau;
                update.ThoiGianKetThuc = shlk.ThoiGianKetThuc;
            }
            sdb.SubmitChanges();
        }
    }
}